Method and system to improve the performance of a video encoder

ABSTRACT

Method and system to improve the performance of a video encoder. The method includes processing an initial video signal in a front-end image pre-processor to obtain a processed video signal and processor information respecting the signal, providing the processed video signal and the processor information to a video encoder, and encoding the video signal in the video encoder according to the processor information to provide an encoded video signal for storage. The system includes a video pre-processor connectable to receive an initial video signal. The video encoder in communication with the video pre-processor receives a processed video signal and a processor information. A storage medium in communication with the video encoder stores an encoded video signal.

This application is a continuation of U.S. patent application Ser. No.15/294,389, filed Oct. 14, 2016, which is a divisional of U.S. patentapplication Ser. No. 12/940,046, filed Nov. 5, 2010, which claimspriority from India Provisional Application Serial No. 2698/CHE/2009filed Nov. 6, 2009, both of which are incorporated herein by referencein their entireties.

TECHNICAL FIELD

Embodiments of the disclosure relate to the field of perceptual qualityenhancement in a video processing system.

BACKGROUND

In a video processing system, a video encoder receives an input videosequence and encodes the video sequence using standard video encodingalgorithms such as H.263, H.264 or various algorithms developed byMoving Picture Experts Group (MPEG). Such video sequences are highlynon-homogeneous, consisting for example of scene changes, variations inmotion, and varying complexity within a frame and between differentframes. The non-homogeneous nature of the video sequence makes the taskof encoding for the video encoder difficult resulting in a need for moreprocessing cycles per frame. Increased complexity in encoding of thevideo sequences also results in high power consumption.

SUMMARY

An example of a method of encoding a video signal includes processing aninitial video signal in a front-end image pre-processor to obtain aprocessed video signal. The method also includes obtaining, from thepre-processor, processor information respecting the processed videosignal. The processed video signal and the processor information areprovided to a video encoder. The video signal is encoded in the videoencoder according to the processor information to provide an encodedvideo signal for storage.

An example of a video system includes a video pre-processor connectableto receive an initial video signal. A video encoder in communicationwith the video pre-processor receives a processed video signal and aprocessor information. A storage medium in communication with the videoencoder stores an encoded video signal.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 is a block diagram illustrating an environment, in accordancewith which various embodiments can be implemented;

FIG. 2 is a flowchart illustrating a method for encoding a video signal,in accordance with an embodiment;

FIGS. 3a and 3b are exemplary video frames illustrating boundary signalcalculations, in accordance with one embodiment;

FIGS. 4a through 4f illustrate various scaling matrices, in accordancewith an embodiment; and

FIG. 5 is an exemplary illustration of a partitioned video frame.

DETAILED DESCRIPTION

FIG. 1 is a block diagram illustrating an environment, in accordancewith which various embodiments can be implemented. The environmentincludes a video source 105. The video source 105 generates a videosequence. The video sequence is fed to a video system 110 for furtherprocessing. In an embodiment, the video source 105 is typically theCCD/CMOS sensor at the front-end of a camera. Examples of the videosource 105 also include, but are not limited to, a playback from adigital camera, a camcorder, a mobile phone, a video player, and astorage device that stores recorded videos. The video source 105 iscoupled to a front-end image pre-processor 115 of the video system 110.In one embodiment, the front-end image pre-processor 115 can be externalto the video system 110. The front-end image pre-processor 115 processesthe input video sequence to generate information corresponding to theinput video sequence by performing a plurality of operations. Examplesof the operations include, but are not limited to, color interpolationto generate a complete set of RGB values for each pixel, image resizing,statistics collection for auto-focus or auto exposure or white balance,horizontal and vertical noise filtering and RGB to YUV conversion. Thefront-end image pre-processor 115 is coupled to a video encoder 120within the video system 110. The video encoder 120 receives theprocessed video sequence and the corresponding information from thefront-end image pre-processor 115 and encodes the processed videosequence. The video encoder 120 encodes the input video sequence usingone of standard video encoding algorithms such as H.263, H.264, andvarious algorithms developed by MPEG-4. The video system 110 furtherincludes an internal memory 125 coupled to the front-end imagepre-processor 115 and the video encoder 120.

The video system 110 is coupled to a direct memory access (DMA) engine130. The DMA 130 allows hardware subsystems to directly access anexternal memory/double data rate (DDR) memory 145. The DMA 130 iscoupled to peripherals as represented by the block 135. Some of theperipherals include, but are not limited to, printers, loudspeakers,image scanners and webcams. The DMA 130 is also coupled to a digitalsignal processor (DSP) 140. The DSP 140 is a specialized microprocessorwith an optimized architecture for the fast operational needs of digitalsignal processing. In an embodiment, the DMA can obtain the informationfor the video sequence from the front-end pre-processor 115 and providesto the video encoder 120.

FIG. 2 is a flowchart illustrating a method for encoding a video signal,in accordance with an embodiment.

A video signal is generated by a video source, for example the videosource 105, and fed as input to a front-end image pre-processor, forexample the front-end image processor 115.

Alternatively, in some embodiments, the video signal fed to thefront-end image pre-processor 115 can be sourced from a storage deviceor “a transcode signal” or a signal from a transmission system. “Thetranscode signal” is a signal used in the conversion of one videoencoding format to another video encoding format. The video signal istransmitted to the front-end image pre-processor 115 for furtherprocessing.

At step 205, the incoming video signal is processed by the front-endimage pre-processor 115 to obtain a processed video signal. Thefront-end image pre-processor 115 is used to perform a variety ofoperations on the incoming video signal. The goal of imagepre-processing is to increase both the accuracy and the interpretabilityof the input image during the image processing phase. The imageprocessed by the front-end image pre-processor 115 is known as a videoframe. The video frame can be defined as one of the many still imagesthat compose a moving picture. A plurality of video frames, herein alsoknown as images, represents the video signal.

The front-end image pre-processor 115 processes the incoming videosignal received from the video source 105. The processing includesextracting sharpness information from the video frame, generating aBayer histogram, extracting automatic exposure data from the videoframe, extracting camera pan, tilt and zoom information, and boundarysignal calculations for the video frame.

Extraction of Sharpness Information:

The sharpness information of the video frame is extracted by thefront-end image pre-processor 115 using an auto-focus algorithm.Auto-focus is used to automatically focus a camera lens onto a desired,nearby object. The auto-focus is achieved by discerning the location ofthe object to be photographed. The sharpness features are extractedusing the auto-focus algorithm to help maximize the sharpnessinformation for the video frame and focus the camera lens accordingly.

Bayer Histogram:

The front-end image pre-processor processes the incoming video signal togenerate a Bayer histogram. A histogram is a graphical representation,showing a visual impression of the distribution of experimental data.The Bayer histogram indicates the distribution of the underlying colorand luminance statistics in the video frame. The Bayer histogram buildssuch statistics by determining the RGB values of a pixel in the videoframe. Using the RGB values of each pixel, histograms of thecolor/luminance pixels can be generated for the video frame.

Automatic Exposure/White Balance (AE/AWB):

The front-end image pre-processor 115 consists of an AE/AWB engine. TheAE/AWB engine is used to set automatic exposure (AE) mode for a capturedevice as embodied by the video source 105. The AE mode enables thevideo source 105 to automatically calculate and adjust exposure settingsfor image capture. White balancing is a technique adopted in imagecapture, to correctly render specific colors, especially neutral colors.The specific colors are rendered by adjusting intensities of the colorswithin the video frame. The AE/AWB engine can be used to automaticallyadjust color intensities for the video frame and thus implementautomatic white balance (AWB). To implement its different functions, theAE/AWB engine computes R, G and B values for different rectangularwindows within a video frame.

Camera Panning and Tilting:

In one embodiment, the video source 105 includes capability to performpan and tilt to effectively capture a video of a desired subject.Rotation of the video camera in the horizontal plane is called panning.The rotation of the video camera in the vertical plane is calledtilting. The extent of camera panning and tilting is measured by anaccelerometer in the video source 105. Alternately, in some applicationssuch as a security camera, the extent of the camera panning and tiltingcan be inferred from the stepper motor that controls the orientation ofthe camera. The camera panning and tilting information can be inferredby the front-end image pre-processor 115 from the accelerometer in thevideo source 105.

Camera Zooming:

In one embodiment, a video source 105 has the capability to zoom thevideo camera to effectively capture a video of a desired object. Camerazooming is the ability of a camera to vary the focal length of its lensand thus alter the perceived view of a camera user. The video camera canzoom-in or zoom-out for the video frame. When zooming occurs, the videosource 105 sets a marker for the frame that has been zoomed. Using themarker, the zooming information can be relayed to the front-end imagepre-processor 115 by the video source 105.

Boundary Signal Computation (BSC)/Motion Stabilization Information:

The front-end image pre-processor 115, performs boundary signalcomputations (BSC) using a boundary signal calculator. The boundarysignal calculator generates row summations and column summations fromYCbCr 4:4:4 video format data of the video frame. Two types of vectorsare generated, a vector of sum of row pixels and a vector of sum ofcolumn pixels. Both the vectors are from one of Y, Cb or Cr data. Boththe vectors can be up to four or greater in number each for row sums andcolumn sums. Y is the luma component and Cb and Cr are theblue-difference and red-difference chroma components.

The video frame is divided into different regions along the horizontaldirection. For each region, a vector sum is generated by summing overthe columns within the region. The division of the video frame intoregions along the horizontal direction and the generation of a vectorsum for each region are explained in detail in conjunction with FIG. 3a.

The video frame is divided into different regions along the verticaldirection. For each region, a vector sum is generated by summing overthe rows within the region. The division of the video frame into regionsalong the vertical direction and the generation of a vector sum for eachregion are explained in detail in conjunction with FIG. 3 b.

The division of the video frame into different regions in the horizontaland vertical directions breaks up the video frame into multipleCartesian grids. Each grid has a column sum vector and a row sum vector.The row sum vector and the column sum vector of a present frame arecompared with the row sum vector and the column sum vector of a previousframe and the closest match is identified. The difference in matchingbetween the row sum vectors and the column sum vectors of a grid in thepresent frame, and the row sum vectors and the column sum vectors of thegrid in the previous frame, gives an estimate of the motion of the grid.

At step 210, the information respecting the processed signal is obtainedfrom the front-end image pre-processor 115. The information includessharpness information, a Bayer histogram information, automatic exposuredata, pan, tilt and zoom information, and boundary signal calculations.

At step 215, a processed video signal and the processor information isprovided by the front-end image pre-processor 115 to the video encoder120.

At step 220, the incoming video signal is encoded in the video encoder120, according to the information provided by the front-end imagepre-processor 115 to provide an encoded video signal for storage ortransmission.

Video encoding is the process of preparing a video for its output wherethe digital video is encoded to meet file formats and specifications forrecording and playback through the use of video encoder software. Thevideo encoder 120 compresses the incoming video signal, to generate anencoded version of the incoming video signal at a lower bit rate. Thevideo encoder 120 seeks to strike a balance between the quality of videoat its output and the quantity of data that can be used to represent it,such that a viewer's experience is not compromised.

The video encoder 120 in one embodiment, utilizes the informationavailable from the front-end image pre-processor 115. The informationfrom the front-end image pre-processor 115 is utilized by the videoencoder 120 to generate a video of better quality at its output. Theinformation from the front-end image pre-processor 115 that is utilizedby the video encoder 120 includes sharpness information, Bayer histograminformation, automatic exposure (AE)/automatic white balance (AWB)information, camera panning and tilting information, camera zoominginformation and boundary signal computation (BSC) information.

Sharpness Information:

The sharpness information of the video frame is extracted by thefront-end image pre-processor 115 using an auto-focus algorithm asexplained at step 205. The sharpness information is used by the videoencoder 120 to improve the quality of video at its output. The sharpnessinformation is utilized to classify the video frame into plurality ofregions. The regions are classified as a smooth region, a textureregion, an edge region and a foreground and a background region.

The smooth region in the video frame is one which has very low imagedetail. The texture region in the video frame is one which has very highimage detail. The edge region is a region in the video frame thatcontains sudden and large changes (“edges”) in color or luminance orboth.

Psycho-visual modeling technique helps in understanding how a humanvisual system (HVS) reacts and/or interprets different images. Thistechnique has led to a variety of perceptual quantization schemes forvideo encoding. The perceptual quantization schemes exploit the maskingproperties of the HVS. Using the masking properties of the HVS, aquantization step size for different regions in the video frame isdecided based on a perceptual importance of the different regions to thehuman eye.

The quantization step size is decided using a property known as texturemasking. Texture masking is also known as detail dependence, spatialmasking or activity masking. The texture masking property states thatthe discrimination threshold of the human eye increases with increasingimage detail. As a result, additive and quantization noise is lesspronounced in the texture regions of a video frame compared to thesmooth region of the video frame. The video frame acts as a ‘masker’ andhides the noise (additive noise, quantization noise). The video encoder120 uses the texture masking property of HVS to select the quantizationstep size for the video frame. The quantization step size is selected onthe basis of the texture content in different parts of the video frame.

According to the texture masking property, the smooth region and theedge region of the video frame are much more perceptually important thanthe texture region. The video encoder 120 makes use of theclassification of the video frame regions to appropriately control thebit budget of the different areas and maximize the overall perceptualquality. The video encoder 120 assigns more bits to the smooth regionand the edge region compared to the texture region. Furthermore, theforeground region is usually assigned more bits than the backgroundregion as objects in foreground region are perceptually considered moreimportant than compared to objects in background.

Let Q_(base) be the quantization step size assigned by the video encoder120 to the video frame. The quantization step size is increased for thetexture region and reduced for the smooth region and the edge region.Furthermore, the quantization step size is reduced for the foregroundarea and increased for the background region. A macroblock is an imagecompression unit, which comprises blocks of pixels. The quantizationstep size for a macroblock in the video frame is given as,

$\begin{matrix}{{Q_{mb} = {Q_{base}*\alpha*\beta}}{{{where}\mspace{14mu}\alpha} = \left\{ {{\begin{matrix}{{\alpha_{s}\mspace{14mu}{for}\mspace{14mu}{smooth}\mspace{14mu}{macroblocks}},{\alpha_{s} < 1}} \\{{\alpha_{e}\mspace{14mu}{for}\mspace{14mu}{edge}\mspace{14mu}{macroblocks}},{\alpha_{e} < 1}} \\{{\alpha_{t}\mspace{14mu}{for}\mspace{14mu}{texture}\mspace{14mu}{macroblocks}},{\alpha_{t} > 1}}\end{matrix}{where}\mspace{14mu}\beta} = \left\{ \begin{matrix}{{\beta_{f}\mspace{14mu}{for}\mspace{14mu}{foreground}\mspace{14mu}{macroblocks}},{\beta_{f} < 1}} \\{{\beta_{b}\mspace{14mu}{for}\mspace{14mu}{background}\mspace{14mu}{macroblocks}},{\beta_{b} > 1}}\end{matrix} \right.} \right.}} & (1)\end{matrix}$

The selection of quantization modulation factors α and β is based on theperceptual importance of the macroblock. The quantization modulationfactors α and β are derived as a function of a current macroblockactivity, previous frame activity, average sum of absolute differences(SAD) of the different regions and the desired quality enhancement forperceptually important regions.

A macroblock activity is the spatial activity within the macroblock. Itis a measure of the texture of a macroblock, and therefore also referredto as “Texture Measure (TM).” The macroblock activity is measured bycomputing the difference between consecutive rows of pixels, taking anabsolute value of the difference and then adding them. The macroblockactivity is also measured by computing the difference betweenconsecutive columns of pixels, taking an absolute value of thedifference and then adding them. In some embodiments, other techniquescan be used for deriving macroblock activity. The macroblock activity ishigh for the texture region and the macroblock activity is low for thesmooth region and the edge region. The macroblock activity is thereforeindicative of the type of macroblock. The frame activity is the averageactivity of all the macroblocks within the frame.

Sum of absolute differences (SAD) is a widely used, extremely simplealgorithm for finding the correlation between macroblocks. It works bytaking the absolute difference between each pixel in the original blockand the corresponding pixel in the block being used for comparison.These differences are summed to create a simple metric of blocksimilarity.

The desired quality enhancement is merely a factor by which theforeground quality is enhanced when compared to the background quality.

The quantization modulation factors α and β are then represented asshown below,

$\begin{matrix}{\alpha = \frac{{\lambda*{TM}} + {TM}_{avg}}{{TM} + {\lambda*{TM}_{avg}}}} & (2)\end{matrix}$Where TM is the current macroblock activity andTM_(avg) is the average macroblock activity of the previous frame andλ is a constant whose value ranges from 0 to 8;

$\begin{matrix}{{\beta_{f} = \left( \frac{{SAD}_{foreground} + \frac{{SAD}_{background}}{\sqrt{\tau}}}{{SAD}_{foreground} + {SAD}_{background}} \right)}{\beta_{b} = {\left( \sqrt{\tau} \right)*\beta_{f}}}} & (3)\end{matrix}$where τ is the desired quality enhancement for the foreground region.The τ can be set manually, and is between 1 (no difference betweenforeground and background region) and 16 (foreground highly emphasizedcompared to background);SAD_(foreground) is the sum of absolute differences for the foregroundregion; andSAD_(background) is the sum of absolute differences for the backgroundregion.

In one embodiment, the incoming video signal can be encoded using ascaling matrix. The scaling matrix is used to render in greater detailthe lower spatial frequencies of a macroblock and render in less detailhigher spatial frequencies. This is in accordance with the behavior ofthe HVS, which is more sensitive to the lower spatial frequencies. Thevideo encoding process entails transforming a macroblock of pixels intothe frequency domain using a discrete-cosine transform (DCT), followedby quantization of the frequency-domain pixels. The scaling matrix isused to determine the quantization step-size applied to thefrequency-domain pixels. A smaller value for an entry in the scalingmatrix implies a lower (finer detail) quantization step-size andvice-versa.

The scaling matrix consists of scaling values used to modify thequantization step size of the macroblock based on the perceptualimportance of the region within the macroblock. A mild scaling matrix isused for the smooth region. The scaling matrix is disabled for the edgeregion as the scaling matrix would smooth out the edges in the edgeregion. A strong scaling matrix is used for the texture region. Usage ofthe strong scaling matrix for the texture region ensures that too manybits are not consumed by the texture region as it is perceptually lessimportant.

The strong scaling matrix is used for the background region and the mildscaling matrix is used for the foreground region to maximize videoquality in the foreground region.

The H.264 video encoding standard allows only one scaling matrix to beused for the entire frame. The scheme of video encoding using multiplescaling matrices within a video frame is to be employed by future videoencoding standards. In order to produce H.264 standard compliant encodedstreams the method of using multiple scaling matrices in a single videoframe is used by making use of the scaling matrices only in the forwardpath.

The different scaling matrices to be employed for the different regionsof the video frame are explained in conjunction with FIG. 4a -4 f.

The front-end image pre-processor 115 also uses the auto-focus algorithmto obtain the average value of the pixels and the average value of thesquare of the pixels. The standard deviation of the pixels within amacroblock can then be calculated as,

$\begin{matrix}{{std\_ dev} = {{\sum\limits_{i = 0}^{n}\left( {x_{i} - \overset{\_}{x}} \right)^{2}} = {{\sum\limits_{i = 0}^{n}x_{i}^{2}} - {\overset{\_}{x}}^{2}}}} & (4)\end{matrix}$where std_dev is the standard deviation andx_(i) is the i^(th) value of the pixels; andx is the average value of the pixels within the macroblock.

In a reduced power consumption mode when battery starts to drain on ahandheld device or a mobile internet device (MID), intra-prediction modeestimation is turned off as it can be approximated with less complexalgorithms that consume lesser power as compared to inter-prediction.The standard deviation is used when performing mode decision in thiscase.

The intra-prediction and the inter-prediction are two modes ofprediction used during encoding. The motion estimation is a videocompression process of determining motion vectors that describe thetranslation from one image to another usually from adjacent frames in avideo sequence. A motion vector is a vector used to represent amacroblock in a picture based on the position of the macroblock, or asimilar macroblock, in a reference picture. Intra-frame prediction is avideo compression technique applied to still images, such as videoframes, photographs and diagrams, and exploits the redundancy within theimage. As such the intra-prediction is equivalent to spatial encoding,that is, it exploits redundancies across different macroblocks of asingle frame. Data redundancy is said to exist when different amounts ofdata are used to represent a single piece of information. Inter-frameprediction is a video compression technique applied to a sequence ofvideo frames, rather than a single image. The inter-frame predictionexploits the similarities between successive frames to reduce the volumeof data required to describe the sequence of video frames. As suchinter-prediction is equivalent to temporal encoding, that is, itexploits redundancies across different frames in time.

Bayer Histogram Information:

The front-end image pre-processor 115 generates a Bayer histogram fromthe incoming video signal as explained at STEP 205. The Bayer histogramis used by the video encoder 120 to improve the quality of video at itsoutput. When a scene change occurs, typically there will be a largevariation in the underlying color and luminance statistics of the videoframe. In order to compare the color and luminance statistics, the Bayerhistogram of the color and luminance pixels can be built for every videoframe. A histogram difference (HD) is a measure of the absolute bin tobin difference between the histograms of two frames. The HD can berepresented as shown below,

$\begin{matrix}{{H\; D} = {\sum\limits_{i}{{{{hist}_{n}(i)} - {{hist}_{n - 1}(i)}}}}} & (5)\end{matrix}$Where hist_(n) is the Bayer histogram for frame n andhist_(n-1) is the Bayer histogram for a frame (n−1);

If the HD is greater than an adaptive threshold, then a scene change isdeemed to have occurred. The threshold can be changed from frame toframe based on past frame statistics. The adaptive threshold can bedefined as a function of (i) histogram distribution, i.e., mean andvariance (ii) scene change detection performed by the video encoder.

Once the new scene is identified, the video encoder 120 will start a newgroup of pictures (GOP). Using appropriate bit allocation, the videoencoder 120 will ensure that a reference picture for the new GOP will beof high quality. Using the high quality reference picture for the newGOP (after scene change), will ensure that the perceptual quality ismaximized for a target bit rate.

A common problem faced in video encoding is dealing with a suddenillumination change. Fade-ins and fade-outs cause the motion predictionto fail and result in degradation of video quality at the output of thevideo encoder 120. The sudden illumination change can be detected bycomparing the Bayer histogram between adjacent video frames. By a-prioridetecting fade-ins and fade-outs, the video encoder 120 will takeappropriate steps to maximize its performance and the quality of videoat its output. The steps taken by the video encoder include (i) enablingall the available intra-prediction mode of motion estimation, (ii) usemore complex techniques to derive more accurate weights for weightedprediction, since weighted prediction works very well for fade-ins andfade-outs. Weighted prediction is an advanced form of inter-predictionprovided by the H.264 standard. In weighted prediction a weighted valueof the previous video frame is subtracted from the current video frame.And finally, (iii) turn off motion estimation, thus eliminatingtransfers related to inter-prediction and reducing the data transferrequirements. The reduction in data transfer requirements will improvethe performance of the video encoder 120 and reduce its powerconsumption.

The video encoder can use the Bayer histogram to derive a histogram forchroma. The histogram for chroma can then be used for chromaquantization parameter (QP) modulation using equations similar toequation (1), equation (2), equation (3) and equation (4). QP is asetting that controls the quality of video compression in MPEG-4 andH.264 video encoding standards and is similar as the quantization stepsize.

Automatic Exposure/White Balance (AE/AWB) Information:

The front-end image pre-processor 115 generates AE/AWB information froman AE/AWB engine as explained at Step 205. The AE/AWB engine computesRGB values for various rectangular windows within the video frame. Thecomputed RGB values are used by the video encoder 120 for various videoquality enhancements. The video quality enhancements include (i) BlackBar detection, (ii) Green signal detection and (iii) identifying complexand non-complex regions within the video frame.

The Black Bar Detection and processing: Many video sequences have blackbars inserted either at the top and bottom of the video frame or at theleft and right of the video frame. The black bar may be detected as anarea of the image where all the R, G and B values are close to zero.Successful and correct detection of black bars can lead to eliminationof annoying pulsating and chroma artifacts. An artifact is a glitch inthe image or an apparent feature in the image that does not exist inreality. In order to reduce perceptual annoyance, we may (i) ensure thatthe quantization parameter (QP) assigned to all the macroblocks in theblack bar regions are the same, and, (ii) ensure the mode of predictionassigned to all the macroblocks in the black bar region are the same.Alternatively, the macroblocks in the black bar region can be coded asskip macroblocks. A skip macroblock is a macroblock for which noinformation is sent to the video decoder with regard to that macroblock.

Furthermore, if it is detected that the edge region of the black barextends only onto part of the macroblock, then for these macroblocks a 4motion vector (MV) motion search can be selectively turned on. Motionsearch is a motion estimation technique where only a portion of theprevious frame is examined for a matching macroblock using a searchwindow called a motion search window. Turning on 4 MV motion search canreduce annoying distortions at black bar edges caused due to motionwithin the video frame. The H.264 standard employs 1 MV motion searchwhere 1 MV is used to perform motion estimation for one macroblock. The4 MV motion search entails dividing the macroblock into 8×8 blocks whereeach block has its own motion vector (MV) to perform motion estimation.

Green Signal Detection: It is an established fact that the human visualsystem (HVS) is much more sensitive to green signal when compared toother colors. The sensitivity to green signal is particularly true whenlarge areas of the video frame are completely green. By detecting theareas of the video frame which are green, the video encoder 120 takesappropriate action to improve the quality of video at its output. Thevideo encoder 120 reduces the quantization parameter (QP) formacroblocks belonging to green regions in the video frame and improvesthe subjective quality of video.

The Complex and non-Complex regions: The computed RGB values of therectangular windows can be used in the determination of a non-complexregion and a complex region in the video frame. To ensure that theoverall perceptual quality of the video frame is maximized, more bitsare usually allocated to the complex region in the video frame comparedto the non-complex region in the video frame.

Detection of the complex region and the non-complex region in the videoframe is performed using a derivative of intensity sensitivity of theeye. According to the Weber Fechner law, brightness sensitivity behavesnon-linearly. Particularly, our sensitivity for brightness variationdecreases with the increase in average brightness. The relationshipbetween brightness and light intensity can be represented as,

$\begin{matrix}{B = {{116\left( \frac{L}{L_{n}} \right)^{\frac{1}{3}}} - 16}} & (6)\end{matrix}$Where B is the perceived brightness;L is the light intensity; andL_(n) is the normalization factor equal to the maximum value of L.

A technique based on the principle illustrated in equation (6) can beused to determine the allocation of the bit budget for a complex andnon-complex areas of the video frame for a block based compressionsystem. The block based compression system is one which uses macroblocksfrom the previous frame to construct a replica of the current frame. Foreach block in the current frame a matching macroblock is found in thepast frame and if suitable, its motion vector is indicated for themacroblock during transmission.

For the block based compression system, the average or DC value of lightintensity of a rectangular partition in the video frame and a variationof the average value of the light intensity across neighboringpartitions can be computed. A partition in the video frame is arectangular window under observation in the video frame. The partitionin the video frame is explained in conjunction with FIG. 5.

The average value of the light intensity in the different partitions canbe determined using the average RGB values determined by the AE/AWBengine. In one embodiment, the Bayer histogram can also be used todetermine the average value of the light intensity in the differentpartitions. The neighbouring partitions can be utilized from theexisting technique used in the H.264 standard.

The derivative of the intensity sensitivity of the eye, L_(d), can berepresented as,

$\begin{matrix}{L_{d} = \frac{\left( {{L\left\lbrack {{x + {\Delta\; x}},{y + {\Delta\; y}}} \right\rbrack} - {L\left\lbrack {x,y} \right\rbrack}} \right)}{\Delta\; x*\Delta\; y}} & (7)\end{matrix}$where, L[x, y] is the intensity sensitivity at position [x,y] in thevideo frame;L[x+Δx, y+Δy] is the intensity sensitivity at position [x+Δx, y+Δy] inthe video frame; andΔx and Δy are pixel position difference along the x and y axis of thevideo frame.

The bit budget allocation method is modulated using equation (7) as afunction of the rate of change of intensity sensitivity of the eye.

A high complexity region of the video frame can be defined as a regionof the video frame satisfying the following two conditions (i) the rateof change of intensity sensitivity of the eye is very high and (ii) thebase level of the average intensity, L(x,y) is lower compared to thesurrounding regions, In mathematical terms, a high-complexity region isone that satisfies the following equations:L _(d)(HiTh)L _(d)  (8)where L_(d) (HiTh) is threshold on a derivative of the intensitysensitivity of the eye, L_(d)L(x,y)≤L _(x,y)(Hi)  (9)where, L_(x,y)(Hi) is the highest intensity in the surrounding regions.i.e., a high complexity region satisfies equations (8) and (9).

A low complexity region of the video frame can be defined as a region ofthe video frame where (i) the rate of change of intensity sensitivity ofthe eye is very low and (ii) the light intensity is higher thansurrounding regions. In mathematical terms, the low-complexity region isone that satisfies the following equations:L _(d) <L _(d)(lowTh)  (10)where L_(d) (HiTh) is threshold on a derivative of the intensitysensitivity of the eye, L_(d) andL(x,y)>L _(y)(Hi)  (11)where, L_(x,y)(Hi) is the highest intensity in the surrounding regions.I.e., a low complexity region satisfies equations (10) and (11).

Once the high complex region and the low complexity region of the videoframe are identified, the quantization step size can be appropriatelymodified for the high complexity region and the low complexity region ofthe video frame. Let Q_(base) be the quantization step size assigned bythe video encoder 120 to the video frame. The quantization step size fora macroblock in the video frame is then given as,

$\begin{matrix}{{Q_{mb} = {Q_{base}*\delta}}{{{where}\mspace{14mu}\delta} = \left\{ \begin{matrix}{{\delta_{l}\mspace{14mu}{for}\mspace{14mu}{low}\mspace{14mu}{complexity}\mspace{14mu}{macroblocks}},{\delta_{l} > 1}} \\{{\delta_{h}\mspace{14mu}{for}\mspace{14mu}{high}\mspace{14mu}{complexity}\mspace{14mu}{marcroblocks}},{\delta_{h} < 1}}\end{matrix} \right.}} & (12)\end{matrix}$

The equation (12) shows that the quantization step size is increased fora low complexity macroblock and decreased for a high complexitymacroblock. Perceptual video improvements are enabled by modifying thequantization step size depending on the complexity of the macroblock.The perceptual video improvements are enabled by re-allocating bits fromthe low complexity macroblocks and assigning them towards the highcomplexity macroblocks. The quantization step size modulation asindicated by equation (12) can be combined with quantization step sizemodulation indicated by equation (1) to give,Q _(mb) =Q _(base)*α*β*δ  (13)where α and β are defined with respect to equation (1).

Camera Panning and Tilting Information: The extraction of camera panningand tilting information by the front-end image pre-processor 115 isexplained at Step 205. The information about the direction of motion ofa camera used in the video source 105 can enable the video encoder 120to perform an improved motion search. The motion search is a process bywhich a rectangular pixel-block of the same size as a macroblock of theprevious frame is identified as being closest to a macroblock of thecurrent frame, for purposes of encoding. The direction of the cameramotion can be inferred using the pan (left-right motion) and tilt(up-down motion) information. The center of the motion search window canbe appropriately modified by taking into account the direction of thecamera motion. Appropriate modification of the center of the motionsearch window using pan and tilt information improves perceptual videoquality at the output of the video encoder 120. As a result, improvedvideo output quality is achieved.

Consider the amount of panning as ‘p’ pixels and let the amount oftilting be ‘t’ pixels. Let the motion search center window be (center_x,center_y). If panning is to the right, ‘p’ is positive. If panning is tothe left, ‘p’ is negative. If tilting is in the upward direction, then‘t’ is negative. If tilting is in the downward direction, then ‘t’ ispositive. The new center of the motion search window using pan and tiltinformation is represented as,new_center_x=center_x−p  (14)andnew_center_y=center_y−t  (15)

Camera Zooming Information: The extraction of camera zooming informationfrom the front-end image pre-processor 115 is explained at Step 205. Themotion search in video encoding makes use of predictors. The predictorsare used in the motion search to determine an instance of camerazooming. When a camera zooms (in or out), the position and size of theobject in a reference frame will vary when compared to a current frame.When a zoom-in/out occurs, objects in the reference frame are smaller orlarger compared to the object in the current frame. The zoom-in/outinformation can be used to scale the predictors appropriately and modifythe center of the motion search window. The zoom-in/out information mayalso also be used to select an appropriate partition size within thevideo frame for best viewing of the subject.

Consider the case of the camera zoom-in. If the zoom-in occurs by afactor of ‘h’ in a horizontal direction and by a factor ‘v’ in avertical direction then, (i) divide the predictor and motion searchcenter vector both by a factor of ‘h’ in the horizontal direction and aby a factor ‘v’ in the vertical direction, and (ii) increase bias forsmaller partition size within the video frame.

If (pred_mv_x, pred_mv_y) was the predictor and zoom-in occurs by afactor ‘h’ in the horizontal direction and ‘v’ in the verticaldirection, then the new predictor co-ordinates are represented as,new_pred_mv_x=pred_mv_x÷h  (16)andnew_pred_mv_y=pred_mv_y÷v  (17)

Consider the case of the camera zoom-out. If the zoom-out occurs by afactor of ‘h’ in a horizontal direction and by a factor ‘v’ in avertical direction then, (i) multiply the predictor and motion searchcenter vector both by a factor of ‘h’ in the horizontal direction and aby a factor ‘v’ in the vertical direction, and (ii) increase bias forlarger partition size within the video frame.

If (pred_mv_x, pred_mv_y) was the predictor and zoom-out occurs by afactor ‘h’ in the horizontal direction and ‘v’ in the verticaldirection, then the new predictor co-ordinates are represented as,new_pred_mv_x=pred_mv_x*h  (18)andnew_pred_mv_y=pred_mv_y*v  (19)

Boundary Signal Computation (BSC) Information/A/lotion StabilizationInformation: The extraction of boundary signal computation (BSC)information by the front-end image pre-processor 115 is explained atStep 205. The front-end image pre-processor 115 uses the BSC informationto break up the video frame into multiple Cartesian grids and estimatethe motion of each grid. The motion of the grid is estimated bycomparing the row-sum and the column-sum of each grid with the grids ofthe previous frame in time and choosing that grid in the previous framethat is closest in value to a grid of the present frame. The BSCinformation is used by the video encoder 120 to estimate the motion of agrid. The motion information related to the motion of the grid can beused by the video encoder 120 to improve the perceptual quality of videoat the output of the video encoder 120. The video encoder 120 can usethe motion information to modify the center of the motion search windowand as a predictor during motion search. The motion information helpsthe video encoder 120 to scale the predictor to a new value and this canbe represented as,new_pred_mv[n,h]=motion_(n_h)  (20)where [n,h] is the grid created by using row vector sum ‘n’ and columnvector sum ‘h’ andnew_pred_mv is the new predictor used in the motion search for themacroblocks in grid [n,h] andmotion_(n,h) is the motion information of the grid [n,h];

In one embodiment, the video encoder 120 can feed information back tothe front-end image pre-processor 115 to improve quality of a videosignal fed to the video encoder 120. The video encoder 120 possessesinformation about the bit consumption in different parts of the videoframe. The bit consumption information can be fed back to the front-endimage pre-processor 115 by the video encoder 120. The front-end imagepre-processor 115 uses the bit consumption information to assist thevideo encoder 120 to achieve better compression. The front-end imagepre-processor 115 uses the bit consumption information to modify itsoperations such as filtering and intensity control and to improve thequality of the video signal. For example, if the front-end imageprocessor 115 is aware of a region in the video frame consuming manybits, then the front-end image pre-processor 115 will apply strongernoise filters to the region. The application of stronger noise filtersin the region consuming many bits will ensure noise in the region isheavily suppressed and quality of the video signal is improved. Thevideo signal of better quality can be encoded better by the videoencoder 120.

FIGS. 3a and 3b illustrate boundary signal calculations for an exemplaryvideo frame in accordance with one embodiment.

FIG. 3a illustrates column sum vector calculation for the video frame.The video frame is divided into different regions of macroblocks in thehorizontal direction. A region 0 of the video frame is marked as 305 a.A region 1 of the video frame is marked as 310 a. A region 2 of thevideo frame is marked as 315 a. A region 3 of the video frame is markedas 320 a. The different regions of the video frame have their own columnsum vectors. The column sum vectors are generated by summing over thecolumns within the region.

The column sum vector for the region marked as 305 a is indicated bycolsum₀. The column sum vector for the region marked as 310 a isindicated by colsum₁. The column sum vector for the region marked as 315a is indicated by colsum₂. The column sum vector for the region markedas 320 a is indicated by colsum₃.

FIG. 3b illustrates row sum vector calculation.

The video frame is divided into different regions of macroblocks in thevertical direction. A region 0 of the video frame is marked as 305 b. Aregion 1 of the video frame is marked as 310 b. A region 2 of the videoframe is marked as 315 b. A region 3 of the video frame is marked as 320b. The different regions of the video frame have their own row sumvectors. The row sum vectors are generated by summing over the rowswithin the region.

The row sum vector for the region marked as 305 b is indicated byrowsum₀. The row sum vector for the region marked as 310 b is indicatedby rowsum₁. The row sum vector for the region marked as 315 b isindicated by rowsum₂. The row sum vector for the region marked as 320 bis indicated by rowsum₃.

The combination of operations illustrated in FIG. 3a and FIG. 3b dividesthe video frame into sixteen Cartesian grids. Each grid has a row sumvector and a column sum vector. The row sum vector and the column sumvector of the present frame are compared with the row sum vector and thecolumn sum vector of a previous frame and the closest match isidentified. The difference in matching of the row sum vectors and columnsum vectors of the current frame and the previous frame gives anestimation of the motion of each of the grid.

FIGS. 4a through 4f illustrate various scaling matrices to be employedfor the different regions of the video frame.

The classification of the video frame into different regions using thesharpness information is as explained at Step 220 of FIG. 2. To maximizevideo quality at the output of the video encoder 120, the mild scalingmatrix is used for the smooth region of the video frame. Also, thestrong scaling matrix is used for the texture region and backgroundregion.

FIG. 4a is an exemplary illustration of a 4×4 mild scaling matrix usedfor the smooth region of the video frame. The scaling matrix consists ofscaling values. This matrix is used in modifying the quantization stepsize of the macroblock based on the perceptual importance of the spatialfrequency components within the macroblock.

The scaling values used in the mild scaling matrix differ by smallnumerical amounts. Consider the scaling values at the top left cornerand at the bottom right corner of the 4×4 mild scaling matrix. Thescaling values at the top left corner and the bottom right corner of the4×4 mild scaling matrix have a small difference value of 16. The scalingvalue at the top left corner and the bottom right corner of the 4×4 mildscaling matrix represent its extremities and they have a very smalldifference value.

FIG. 4b is an exemplary illustration of an 8×8 mild scaling matrix usedfor the smooth region of the video frame.

Consider the scaling value at the top left corner and the bottom rightcorner of the 8×8 mild scaling matrix. The scaling values at the topleft corner and the bottom right corner of the 8×8 mild scaling matrixhave a small difference value of 16. The scaling value at the top leftcorner and the bottom right corner of the 8×8 mild scaling matrixrepresent its extremities and they have a very small difference value.

FIG. 4c is an exemplary illustration of a 4×4 strong scaling matrix forintra-macroblock coding in the texture region and the background regionof the video frame.

The scaling values used in the strong scaling matrix differ by a largenumerical value. Consider the scaling values at the top left corner andthe bottom right corner of the 4×4 strong scaling matrix. The scalingvalues at the top left corner and the bottom right corner of the 4×4strong scaling matrix have a large difference value of 72. The scalingvalue at the top left corner and the bottom right corner of the 4×4strong scaling matrix represent its extremities and they have a verylarge difference value.

FIG. 4d is an exemplary illustration of an 8×8 strong scaling matrix forintra-macroblock coding in the texture region and the background regionof the video frame.

The scaling values used in the strong scaling matrix differ by a largenumerical value. Consider the scaling values at the top left corner andthe bottom right corner of the 8×8 strong scaling matrix. The scalingvalues at the top left corner and the bottom right corner of the 8×8strong scaling matrix have a large difference value of 72. The scalingvalue at the top left corner and the bottom right corner of the 8×8strong scaling matrix represent its extremities and they have a verylarge difference value.

FIG. 4e is an exemplary illustration of a 4×4 strong scaling matrix forinter-macroblock coding in the texture region and the background regionof the video frame.

The scaling values used in the strong scaling matrix differ by a largenumerical value. Consider the scaling values at the top left corner andthe bottom right corner of the 4×4 strong scaling matrix. The scalingvalues at the top left corner and the bottom right corner of the 4×4strong scaling matrix have a large difference value of 48. The scalingvalue at the top left corner and the bottom right corner of the 4×4strong scaling matrix represent its extremities and they have a verylarge difference value.

FIG. 4f is an exemplary illustration of an 8×8 strong scaling matrix forinter-macroblock coding in the texture region and the background regionof the video frame.

The scaling values used in the strong scaling matrix differ by a largenumerical value. Consider the scaling values at the top left corner andthe bottom right corner of the 8×8 strong scaling matrix. The scalingvalues at the top left corner and the bottom right corner of the 8×8strong scaling matrix have a large difference value of 52. The scalingvalue at the top left corner and the bottom right corner of the 8×8strong scaling matrix represent its extremities and they have a verylarge difference value. In some embodiments, the difference in scalingvalues is comparatively lesser in inter macroblock coding than in intramacroblock coding.

FIG. 5 is an exemplary illustration of a partitioned video frame.

The partitioned video frame has different partitions each of dimensionN×M where N represents the number of rows of pixels in the partition andM represents the number of columns of pixels in the partition. Thedifferent partitions in the partitioned video frame include thepartitions labeled A, B, C and D. A fifth partition is also labeledwhich is the partition currently under computation to determine its RGBvalues. The partitioned video frame is used by an AE/AWB engine in thefront-end image pre-processor 115 to compute average RGB values, andvariation across partitions in the RGB values, for a selected partitionof the video frame as explained at Step 220 of FIG. 2. An average valueof intensity is determined using the computed RGB values. In oneembodiment, a Bayer histogram can also be used to determine the averagevalue of the light intensity in the different partitions. Using theaverage value of light intensity, a bit allocation technique for thevideo frame is implemented. The bit allocation technique is explained indetail in step 220 of FIG. 2.

Information available in the front-end processors are useful in handlingscene changes in a video signal, identifying artifacts in the videosignal, identifying motion changes in video signal, identifying zoom,pan and tilt, and enhancing perceptual quality of the video signal. Theuse of the information by video encoder helps in improved encoded videoquality, improved performance and robustness of the video encoders. Insome embodiments, the usage of information allows operability of thevideo encoders in reduced power mode in hand held devices.

In the foregoing discussion, each of the terms “coupled” and “connected”refers to either a direct electrical connection or mechanical connectionbetween the devices connected or an indirect connection throughintermediary devices.

The foregoing description sets forth numerous specific details to conveya thorough understanding of embodiments of the disclosure. However, itwill be apparent to one skilled in the art that embodiments of thedisclosure may be practiced without these specific details. Somewell-known features are not described in detail in order to avoidobscuring the disclosure. Other variations and embodiments are possiblein light of above teachings, and it is thus intended that the scope ofdisclosure not be limited by this Detailed Description, but only by theClaims.

The invention claimed is:
 1. A method of encoding a video signalcomprising: generating, by a pre-processor circuit, a video signal, thevideo signal including a frame; receiving, by an encoder from thepre-processor circuit, processor information with respect to the videosignal, the processor information comprising sharpness values;determining, by the encoder, a sharpness for a region of the frame inthe video signal based on the received processor information;classifying the region of the frame into a texture based on thedetermined sharpness; and modifying, by the encoder, a quantization stepsize for the region of the frame based on the classified texture for theregion of the frame.
 2. The method as in claim 1 and further comprising:encoding, by the encoder, the region of the frame using the modifiedquantization step size.
 3. The method as in claim 1 wherein theprocessor information includes automatic exposure data.
 4. The method asin claim 1, wherein the processor information includes pan, tilt, andzoom information of a video capturing device.
 5. The method as in claim1, wherein the processing of the video signal is performed by apre-processor in communication with a video capturing device.
 6. Themethod as in claim 1, wherein the processor information comprises motionstabilization information.
 7. The method as in claim 1, wherein theprocessor information comprises a Bayer histogram; and furthercomprising initiating, by the encoder, a new group of pictures forencoding based on the Bayer histogram.
 8. The method as in claim 1,further comprising: determining average RGB values for the region of theframe.
 9. The method as in claim 8, and further comprising: detectingblack bar areas in the frame; and assigning a single quantization stepsize for macroblocks representing the black bar areas in the frame. 10.The method as in claim 8, and further comprising: detecting greenregions in the frame using the average RGB values; and reducing thequantization step size for macroblocks representing the green regions inthe frame.
 11. A video system comprising: a video pre-processorconfigured to generate a video signal, the video signal including aframe; a video encoder coupled to the video pre-processor, the videoencoder configured to: receive the video signal from the videopre-processor; and receive processor information with respect to thereceived video signal, the processor information comprising sharpnessvalues; and a non-transitory computer readable storage medium storing aprogram for execution by the video encoder, the program includinginstructions to: determine a sharpness for a region of the frame in thevideo signal; classify the region of the frame into a texture based onthe determined sharpness; and modify a quantization step size for theregion of the frame based on the classified texture for the region ofthe frame.
 12. The video system as in claim 11 wherein the processorinformation includes automatic exposure data.
 13. The video system as inclaim 11, wherein the processor information includes pan, tilt, and zoominformation of a video capturing device.
 14. The method as in claim 11,wherein the processor information includes a Bayer histogram; andfurther comprising initiating, by the encoder, a new group of picturesfor encoding based on the Bayer histogram.